package com.ddwl.wallet.service.dto;

import com.ddwl.common.constant.DistConstant;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/**
 * 类UserWalletChangeDto.java的实现描述：用户资金变动记录表
 *
 * @author zach
 * @Date :2020-07-24 16:54.
 */
@Getter
@Setter
public class UserWalletChangeDto {

    /**
     * 用户ID
     */
    private String userId;
    /**
     * 变动记录Id
     */
    private String changeRecord;
    /**
     * 变更类型 0 支出1收入
     */
    private Integer transactionType;
    /**
     * 0 分润佣金结算 1提现
     */
    private Integer type;
    /**
     *账户变动金额
     */
    private BigDecimal changeAmount;

    /**
     * 构建变更金额对象
     * @param changeRecord
     * @param userId
     * @param walletFlowType
     * @param amount
     * @return
     */
    public static UserWalletChangeDto buildUserWalletChangeDto(String changeRecord, String userId, DistConstant.WalletFlowType walletFlowType, BigDecimal amount) {
        UserWalletChangeDto userWalletChangeDto = new UserWalletChangeDto();
        userWalletChangeDto.setUserId(userId);
        userWalletChangeDto.setChangeRecord(changeRecord);
        userWalletChangeDto.setType(walletFlowType.getType());
        userWalletChangeDto.setTransactionType(walletFlowType.getTransactionType());
        userWalletChangeDto.setChangeAmount(amount);
        return userWalletChangeDto;
    }
}
